import React, { Component} from 'react'
import classnames from 'classnames';
// import {svgReq} from 'src/utils/svgReq';


class Svg extends Component {

  constructor(props) {
    super(props);
  }

  render() {
    const props = this.props;
    const { hash,href,title, className, ...others } = props;
    const cls = classnames("svg-default",{[`${className}`]:true});
    const _hash = (hash||"#svg-empty").replace("#","");
    // const _src = (href?href:(require(`./images/${svgReq(`icon.svg${_hash}`)}`)+_hash));
    //两种使用方式并存 示例{require(`../Component/images/${svgReq(`icon.svg${_hash}`)}`)+_hash}
    const _src = (href?href:(require(`./images/${_hash}.svg`)));
    return (
      <img className={cls} title={title} {...others} src={_src} alt={title}/>
    )
    /*if(__CLIENT__){
      return (
        <img className={cls} title={title} {...others} src={_src} alt={title}/>
      )
    }
    return (
        <svg className={cls} title={title} {...others}>
          <use xmlnsXlink="http://www.w3.org/1999/xlink" xlinkHref={_src} />
        </svg>
    )*/
  }
}

export default Svg
